package com.heima.utils.thread;

import com.heima.model.admin.pojos.AdUser;

//threadloacl

public class AdThreadLocalUtil {

    private static final ThreadLocal<AdUser> AD_USER_THREAD_LOCAL = new ThreadLocal<>();


    //存入用户到threadlocal
    public static void setUser(AdUser adUser){
        AD_USER_THREAD_LOCAL.set(adUser);
    }

    //获取用户
    public static AdUser getUser(){
        return AD_USER_THREAD_LOCAL.get();
    }

    //清理
    public static  void clear(){
        AD_USER_THREAD_LOCAL.remove();
    }
}
